<%--
  Created by IntelliJ IDEA.
  User: Shisanyang
  Date: 2020/4/5
  Time: 13:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%pageContext.setAttribute("contextPath", request.getContextPath());%>
<html>
<head>
    <title>City</title>
</head>
<body>

    <table cellpadding="5" cellspacing="0" border="1">
        <tr>
            <th>id</th>
            <th>name</th>
            <th>pinyin</th>
            <th>type</th>
        </tr>

        <c:forEach items="${pageInfo.list}" var="city">
            <tr>
                <td>${city.id}</td>
                <td>${city.name}</td>
                <td>${city.pinYin}</td>
                <td>${city.type}</td>
            </tr>
        </c:forEach>

        <tr>
           <td colspan="4">
               <a href="${contextPath}/cities?pageNum=1">首页</a>
               <a href="${contextPath}/cities?pageNum=${pageInfo.prePage}">上一页</a>
               <c:forEach items="${pageInfo.navigatepageNums}" var="num">
                    <c:if test="${num == pageInfo.pageNum}">
                        【${num}】
                    </c:if>
                   <c:if test="${num != pageInfo.pageNum}">
                       <a href="${contextPath}/cities?pageNum=${num}">${num}</a>
                   </c:if>
               </c:forEach>
               <a href="${contextPath}/cities?pageNum=${pageInfo.nextPage}">下一页</a>
               <a href="${contextPath}/cities?pageNum=${pageInfo.pages}">末页</a>
           </td>
        </tr>
    </table>

</body>
</html>
